<?php

use yii\helpers\Html;
use common\components\Upload;
/* @var $this yii\web\View */
/* @var $model common\models\sys\SysOprationLog */

$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Sys Opration Logs', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;

$logs = explode("###", $model->description);
$piclogs = explode(',',$model->picture);

?>


<section class="wrapper site-min-height">
    <!-- page start-->
    <section class="panel">
        <header class="panel-heading">
              <?= Html::a('返回','javascript:history.back(-1)'); ?>  <?= Html::encode($this->title) ?>
        </header>
        <div class="panel-body">
            <div class="adv-table editable-table ">

                <div class="sys-opration-log-view">

                    <div class="row">
                        <div class="col-md-8 col-md-offset-2">
                            <h3 style="text-align: center"><?= $model->title ?></h3>
                            <table class="table table-striped" style="margin-top: 20px;">
                                <tr>
                                    <th>项目</th>
                                    <th>原有的值</th>
                                    <th>修改后的值</th>
                                </tr>
                                <?php foreach ($logs as $key => $row) { ?>
                                    <?php $items = preg_split("/=@=/", $row);?>
                                    <tr>
                                        <td style="width:10%"><?= $items[0]?></td>
                                        <td style="width:45%"><?= $items[1] ?></td>
                                        <td style="width:45%"><?= $items[2] ?></td>
                                    </tr>
                                <?php } ?>

                                <?php  if(!empty($model->picture)) { ?>
                                    <?php foreach ($piclogs as $key => $row) { ?>
                                        <?php $items = preg_split('=@=',$row);?>
                                        <tr>
                                            <td><?= $items[0] ?></td>
                                            <td><?= $items[1] ?></td>
                                            <td>
                                                <?php
                                                    $img = Upload::checkGetUrl($items[2],true);
                                                    $html = '';
                                                    foreach ($img as $key => $row) {
                                                        $html .= Html::img($row,['width'=>50,'height'=>50,'title'=>$row,'style'=>'margin-right:10px;']);
                                                    }
                                                    echo $html;
                                                ?>
                                            </td>
                                        </tr>
                                    <?php } ?>
                                <?php } ?>
                            </table>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </section>
</section>